package com.zebraphp.devtool.util;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class IToast {
	private static Toast mToast;

	// ============Toast系列===============
	public static void show(Context context, String text, int duration) {

		if (mToast == null) {
			//先设置null,在设置文本 可 解决 在小米手机上 toast带应用名称问题
			mToast = Toast.makeText(context, null, duration);
			mToast.setText(text);
		} else {
			mToast.setText(text);
			mToast.setDuration(duration);
		}

		mToast.show();
	}

	public static void show(Context context, String text) {
		if (mToast == null) {
			mToast = Toast.makeText(context, null, Toast.LENGTH_SHORT);
			mToast.setText(text);
		} else {
			mToast.setText(text);
			mToast.setDuration(Toast.LENGTH_SHORT);
		}
		mToast.show();

	}

	public static void show(Context context, int text) {

		if (mToast == null) {
			mToast = Toast.makeText(context, null, Toast.LENGTH_SHORT);
			mToast.setText(text);
		} else {
			mToast.setText(text);
			mToast.setDuration(Toast.LENGTH_SHORT);
		}
		mToast.show();
	}
}
